import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooUctooUserController } from '../../../controllers';
const uctoouctooUserRouter = new Router();
const uctooUserController = new uctooUctooUserController();

uctoouctooUserRouter.post('/add', requireUser, uctooUserController.add);
uctoouctooUserRouter.post('/edit', requireUser, rowLevelPermission('uctoo/uctoo_user'), uctooUserController.edit);
uctoouctooUserRouter.post('/del', requireUser, rowLevelPermission('uctoo/uctoo_user'), uctooUserController.delete);

//For getting uctooUser with permission control
uctoouctooUserRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/uctoo_user'), uctooUserController.getSingle);
uctoouctooUserRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/uctoo_user'), uctooUserController.getMany);
uctoouctooUserRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/uctoo_user'), uctooUserController.getMany);

//#endregion AutoCreateCode
uctoouctooUserRouter.get('/all', uctooUserController.handleAllUsers);
uctoouctooUserRouter.get('/all/groups', uctooUserController.handleAllUsersWithGroups);
uctoouctooUserRouter.get('/:user', uctooUserController.handleAllUsersGroups);
uctoouctooUserRouter.get('/:user/g/:group', uctooUserController.handleUserGroupLinks);
uctoouctooUserRouter.post('/profile/image/upload',requireUser, uctooUserController.handleProfileImageUpload);
export default uctoouctooUserRouter;
